"use strict"; !
function(n) {
    var o, e = decodeURIComponent(function(n) {
        var o = new RegExp("(^|&)" + n + "=([^&]*)(&|$)", "i"),
        e = window.location.search.substr(1).match(o);
        return null !== e ? unescape(e[2]) : null
    } ("url")),
    l = "",
    c = !1,
    s = n("#log"),
    t = n("body"),
    p = !0,
    r = function(n) {
        c = !0,
        l += n.data.replace(/[\n]/g, "<br>")
    },
    i = function() {
        console.log("连接打开！")
    };
    n(window).bind("mousewheel",
    function(o, e) {
        var l = e > 0 ? "Up": "Down";
        p ? "Up" == l && (p = !1) : s.height() - n(this).scrollTop() < n(this).height() + 20 && (p = !0)
    }),
    "" === e ? s.append('<p class="nolog">无日志信息</p>') : 0 === e.indexOf("ws") ? (o = new WebSocket(e), o.onopen = function(n) {
        i()
    },
    o.onmessage = function(n) {
        r(n)
    },
    o.onclose = function() {
        console.log("连接被关闭！")
    },
    setInterval(function() {
        c && (s.append(l), p && t.scrollTop(s.height()), c = !1, l = "")
    },
    1e3)) : n.ajax({
        method: "GET",
        url: e,
        success: function(n) {
            if (n.result) {
                var o = n.result.replace(/[\n\r]/g, "<br>");
                s.append(o),
                t.scrollTop(s.height())
            } else s.append('<p class="nolog">无日志信息</p>')
        },
        error: function() {
            s.append('<p class="nolog">请求错误！</p>')
        }
    })
} (jQuery);